﻿using System.Collections.Generic;
using Core.ApiMetods.Abstract;
using Core.Helpers;
using DomainModels.DomainModels.JsonModels;
using DomainModels.DomainModels.Systems;

namespace Core.ApiMetods
{
    public class MethodUsers : BaseMethod
    {
        private const string UsersGet = "users.get";

        private const string UserFields =
            " uid,first_name,last_name,nickname,screen_name,sex,bdate,city,country," +
            "timezone,photo,photo_medium,photo_big,has_mobile,rate,contacts,education,online,counters";

        public MethodUsers(TokenResponse tokenObj) : base(tokenObj)
        {
        }

        public override BaseEntyti Get(params string[] args)
        {
            var parameters = new Dictionary<string, string> { { "uids", TokenObj.UserId }, { "fields", UserFields } };
            var url = UrlBuilder.Builder(TokenObj, UsersGet, parameters);

            var str = WebHelper.GetRequest(url);

            return JsonHelper.Json2Object<Users>(str);
        }
    }
}